<?php

namespace App\Http\Controllers;

use GuzzleHttp\Client;

class Test1Controller extends Controller
{

    public function test()
    {
        $header = [
            "accept" => "application/json, text/javascript, */*; q=0.01",
            "accept-encoding" => "gzip, deflate, br",
            "accept-language" => "zh-CN,zh;q=0.9",
            // "content-length" => 33,
            "content-type" => "application/x-www-form-urlencoded; charset=UTF-8",
            "origin" => "https://puwise.com",
            "referer" => "https://puwise.com/site/ppsuc.wise/card/6337682.wise/recharge",
            "sec-ch-ua" => '"Chromium";v="104", " Not A;Brand";v="99", "Google Chrome";v="104"',
            "sec-ch-ua-mobile" => "?0",
            "sec-ch-ua-platform" => "macOS",
            "sec-fetch-dest" => "empty",
            "sec-fetch-mode" => "cors",
            "sec-fetch-site" => "same-origin",
            "user-agent" => "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36",
            "x-requested-with" => "XMLHttpRequest",
            "cookie" => "Partner=MTY2MDQ2MDYxN3xOd3dBTkRKYVUwdGFVVmhXUTFOR1NqZFdUVEpZTkVaUlJFZE1TMDFQVWxsSVFVRk9UVEpZV2s5RlZqUlhVVmxNUkRKR1YxQlBTa0U9fLSqtnhxoFEKQCgNZxrFibjr9le8Hv-UrRBADejqPN6v"
        ];

        $client = new Client([
            // Base URI is used with relative requests
            // 'base_uri' => 'https://puwise.com'
            'timeout' => 3.0
        ]);
        $response = $client->request("POST","https://puwise.com/site/ppsuc.wise/card/6337682.wise/recharge", [
            'headers' => $header,
            'form_params' => [
                "Action" => "input",
                "AmountOption" => 1,
                "Amount" => 1
            ]
        ]);
        dd($response->getBody()->getContents());
    }

}
